package com.mall.goods.application.service;


import com.mall.user.domain.model.GoodsCommon;
import com.mall.user.domain.port.in.AdminGoodsListCase;
import com.mall.user.domain.port.out.AdminGoodsRepository;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminGoodsListService implements AdminGoodsListCase {


    @Resource
    private AdminGoodsRepository adminGoodsRepository;

//    @Override
//    public GoodsListVO getGoodsListCase() {
//
//        GoodsListVO goodsListVO = new GoodsListVO();
//        goodsListVO.setGoodsList(adminGoodsRepository.findAll());
//        goodsListVO.setWaitCount(adminGoodsRepository.findWaitCount());
//
//
//        return goodsListVO;
//    }


    /**
     * 获取待审核商品数量
     * @author yangfei
     */
    @Override
    public long getWaitCount() {


        long waitCount = adminGoodsRepository.findWaitCount();
//        if (waitCount==null){
//            throw new RuntimeException("获取商品数量失败");
//        }
        return  waitCount;
    }

    @Override
    public List<GoodsCommon> getGoodsList() {

        return adminGoodsRepository.findAll();
    }
}
